import request from '../utils/request';

import { UrlConfig} from './fetch';
const option = function(data){
  return{
      method: 'post',
      headers: {'Content-Type': 'application/json; charset=utf-8'},
      body: JSON.stringify(data)
    }
}
/**
 * 获取分类 版面列表
 */
export function getTypeList() {
    let token = localStorage.getItem('token') ? localStorage.getItem('token') : '';//获取当前用户授权的版面

    return request(UrlConfig+'/fcvideo/Plate/plateList?token='+token);
  }
/**
 * 获取视频列表  搜索
 */
export function getVideoList(data) {
  let index = data.index?data.index:'',
  plate_id = data.plate_id?data.plate_id:'',
  page_size = data.page_size?data.page_size:'9999999999',
  status = data.status?data.status:'',
  state = data.state?data.state:'',
  key = data.key?data.key:'',
  start = data.start?data.start:'',
  end = data.end?data.end:'';
  return request(UrlConfig+'/fcvideo/Video/videoList?is_admin=1&index='+index+'&plate_id='+plate_id+'&page_size='+page_size+'&start='+start+'&status='+status+'&key='+key+'&state='+state+'&end='+end);
}
/**
 * 删除视频稿件
 */
export function deleteVideo(data) {
  return request(UrlConfig+'/fcvideo/Video/deleteVideo',option(data));
}
/**
 * 上下架视频
 */
export function upDownVideo(data) {
  return request(UrlConfig+'/fcvideo/Video/changeState',option(data));
}
/**
 * 审核视频状态
 */
export function auditVideo(data) {
  return request(UrlConfig+'/fcvideo/Video/changeStatus',option(data));
}
